package cn.git.demo.service.impl;

import cn.git.demo.dao.SysUserDao;
import cn.git.demo.pojo.SysUser;
import cn.git.demo.pojo.User;
import cn.git.demo.service.SysUserService;
import cn.git.demo.utils.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service("sysUserService")
public class SysUserServiceImpl implements SysUserService{

    @Autowired
    SysUserDao sysUserDao;


    public SysUser selectSysUserByCode(String username) {
            return sysUserDao.selectSysUserByCode(username);
    }

    public SysUser selectSysUserByEmail(String email) {

        return sysUserDao.selectSysUserByEmail(email);
    }

    public void addSysUser(SysUser sysUser) {
        //对密码进行md5加密
        String pwd = MD5Utils.md5(sysUser.getPassword());
        sysUser.setPassword(pwd);
        sysUserDao.addSysUser(sysUser);
    }
}
